<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
  <meta http-equiv="X-UA-Compatible" content="IE=Edge,Chrome=1" />
  <title>Document</title>
</head>

<body>
  <select onmousedown="selectorMode(this,5)" onblur="selectorMode(this,false)" onchange="selectorMode(this,false);hasData(this)">
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
    <option value="4">4</option>
    <option value="5">5</option>
    <option value="6">6</option>
    <option value="7">7</option>
    <option value="8">8</option>
    <option value="9">9</option>
    <option value="10">10</option>
  </select>
  <script>
    /**
     * cursor: this指针
     * status: {Number}选择框显示个数，false||0关闭
     */
    function selectorMode(cursor, status) {
      if (cursor.options.length > status - 1 && status) cursor.size = status;
      if (!status) {
        cursor.size = 0;
        cursor.blur();
      }
    }

    function hasData(cursor) {
      console.log(cursor.value)
    }
  </script>
</body>

</html>